//
// created by zhangyan, all rights reserved.
//

#ifndef __DIYLANE_BUSINESS_SERVICE_ARGUMENTS_H
#define __DIYLANE_BUSINESS_SERVICE_ARGUMENTS_H

#include <string>
#include <unordered_map>

namespace diylane
{
namespace service
{
struct Arguments
{
    std::unordered_map<std::string, std::string> list_;
    Arguments() {

    }
    ~Arguments() {

    }

    void set(std::string k, std::string v) {
        list_[k] = v;
    }

    void set(std::string k, const char* v) {
        if (v)
            list_[k] = v;
    }

    bool exist(std::string k) {
        if (list_.find(k) != list_.end()) {
            return true;
        }
        return false;
    }

    std::string get(std::string k, bool checkExist = false) {
        std::string v;
        if (checkExist) {
            if (!exist(k)) {
                return v;
            }
        }
        v = list_[k];
        return v;
    }

};
}
}

#endif